package com.qianjiangcloud.store.util;

import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.qianjiangcloud.store.Run;
import com.qianjiangcloud.store.activity.AgentActivity;
import com.qianjiangcloud.store.modle.AbnormalShape;
import com.qianjiangcloud.store.modle.AbnormalShapeList;
import com.qianjiangcloud.store.modle.Shortcut;
import com.qianjiangcloud.store.modle.ShortcutList;
import com.qianjiangcloud.store.ui.CircleImageView;

import org.json.JSONException;
import org.json.JSONObject;

import com.qianjiangcloud.store.R;
import com.qianjiangcloud.store.libary.cache.MyImageLoader;

/**
 * Created by caojian on 16/7/8.
 */
public class ObtainViewFromType {
    /**
     * Created by caojian on 16/6/28.
     */
    //滑动广告
    private static final int SLIDE_ADVERTISEMENT_TYPE = 1;
    //新闻广告
    private static final int NEWS_ADVERTISEMENT_TYPE = 3;
    //滑动商品
    private static final int SLIDE_GOOD_TYPE = 5;
    //商品展示栏
    private static final int GOOD_SHOW_TYPE = 4;
    //快捷入口
    private static final int SHORTCUT_ENTRANCE_TYPE = 2;
    //异形-热门市场
    private static final int HOT_TYPE = 6;
    //异性-超实惠
    private static final int BENEFIT_TYPE = 7;
    //异性-主题馆
    private static final int THEME_TYPE = 8;
    //异形-特色好货
    private static final int FEATURE_TYPE = 9;
    //异形-品牌秀
    private static final int BRAND_TYPE = 10;
    private static CallBack callBack;

    static LinearLayout more = null;
    private  static  Context mContext;
    static RelativeLayout isshow_title = null;
        //type item 的类型  weight 长宽比
        public static View getView(int type, Context context) {
            mContext=context;
            View view = null;
            switch (type) {
                case SLIDE_ADVERTISEMENT_TYPE:
                    view = new MainFragmentAdsUtils().getAdsViews(context);
                    break;
                case NEWS_ADVERTISEMENT_TYPE:
                    view = new NewsAdsUtils().getNewsAdsViews(context);
                    break;
                case SLIDE_GOOD_TYPE:
                    view = new SlidingGoodsUtils().getSlidGoodsViews(context);
                    break;
                case GOOD_SHOW_TYPE:
                    view = new GoodsDisplayUtils().getGoodsDisplayItem(context);
                    break;
                case SHORTCUT_ENTRANCE_TYPE:
                    view = LayoutInflater.from(context).inflate(R.layout.shortcut_entrance, null);
                    break;
                case BENEFIT_TYPE:
                    view = LayoutInflater.from(context).inflate(R.layout.abnormalsharp_benefits_item, null);
                    break;
                case THEME_TYPE:
                    view = LayoutInflater.from(context).inflate(R.layout.abnormalsharp_theme_item, null);
                    break;
                case FEATURE_TYPE:
                    view = LayoutInflater.from(context).inflate(R.layout.abnormalsharp_feature_item, null);
                    break;
                case BRAND_TYPE:
                    view = LayoutInflater.from(context).inflate(R.layout.abnormalsharp_brand_item, null);
                    break;
                case HOT_TYPE:
                    view = LayoutInflater.from(context).inflate(R.layout.abnormalsharp_hot_item, null);
                    break;
            }
            return view;
    }
    public void setCallBack(CallBack callBack){
        this.callBack=callBack;
    }

    public static void setDateHotView(final String module_id, View view, int type, Context context, String json, double weight, String title, String title_icon, String title_color, int column_num, String moudle_icon, String isshow_module_title, String isshow_sub_module) {
        more = (LinearLayout) view.findViewById(R.id.look_more);
        if (isshow_sub_module.equals("true")) {
            more.setVisibility(View.VISIBLE);
        }
        isshow_title = (RelativeLayout) view.findViewById(R.id.isshow_title);
        if (isshow_module_title.equals("false")) {
            isshow_title.setVisibility(View.GONE);
        }
        TextView hot_title_name = (TextView) view.findViewById(R.id.title);
        ImageView hot_icon = (ImageView) view.findViewById(R.id.image_icon);
        ImageView hot_title_image = (ImageView) view.findViewById(R.id.image);
        if (null != title) {
            hot_title_name.setText(title);
        }
        if (null != title_color) {
            hot_title_name.setTextColor(Color.parseColor(title_color));
            hot_icon.setBackgroundColor(Color.parseColor(title_color));
        }
        if (null != title_icon && !TextUtils.isEmpty(title_icon)) {
            MyImageLoader.displayDefaultImage(title_icon, hot_title_image);
        } else {
            hot_title_image.setVisibility(View.GONE);
        }
        LinearLayout module_0= (LinearLayout) view.findViewById(R.id.module_0);
        LinearLayout module_1= (LinearLayout) view.findViewById(R.id.module_1);
        LinearLayout module_2= (LinearLayout) view.findViewById(R.id.module_2);
        LinearLayout module_3= (LinearLayout) view.findViewById(R.id.module_3);
        LinearLayout module_4= (LinearLayout) view.findViewById(R.id.module_4);
        LinearLayout module_5= (LinearLayout) view.findViewById(R.id.module_5);
        LinearLayout module_6= (LinearLayout) view.findViewById(R.id.module_6);
        LinearLayout module_7= (LinearLayout) view.findViewById(R.id.module_7);
        LinearLayout module_8= (LinearLayout) view.findViewById(R.id.module_8);
        TextView hot_title_0 = (TextView) view.findViewById(R.id.title_0);
        TextView hot_content_0 = (TextView) view.findViewById(R.id.content_0);
        ImageView hot_imageView_0 = (ImageView) view.findViewById(R.id.image_0);
        TextView hot_title_1 = (TextView) view.findViewById(R.id.title_1);
        TextView hot_content_1 = (TextView) view.findViewById(R.id.content_1);
        ImageView hot_imageView_1 = (ImageView) view.findViewById(R.id.image_1);
        TextView hot_title_2 = (TextView) view.findViewById(R.id.title_2);
        TextView hot_content_2 = (TextView) view.findViewById(R.id.content_2);
        ImageView hot_imageView_2 = (ImageView) view.findViewById(R.id.image_2);
        TextView hot_title_3 = (TextView) view.findViewById(R.id.title_3);
        TextView hot_content_3 = (TextView) view.findViewById(R.id.content_3);
        ImageView hot_imageView_3 = (ImageView) view.findViewById(R.id.image_3);
        TextView hot_title_4 = (TextView) view.findViewById(R.id.title_4);
        TextView hot_content_4 = (TextView) view.findViewById(R.id.content_4);
        ImageView hot_imageView_4 = (ImageView) view.findViewById(R.id.image_4);
        TextView hot_title_5 = (TextView) view.findViewById(R.id.title_5);
        TextView hot_content_5 = (TextView) view.findViewById(R.id.content_5);
        ImageView hot_imageView_5 = (ImageView) view.findViewById(R.id.image_5);
        TextView hot_title_6 = (TextView) view.findViewById(R.id.title_6);
        TextView hot_content_6 = (TextView) view.findViewById(R.id.content_6);
        ImageView hot_imageView_6 = (ImageView) view.findViewById(R.id.image_6);
        TextView hot_title_7 = (TextView) view.findViewById(R.id.title_7);
        TextView hot_content_7 = (TextView) view.findViewById(R.id.content_7);
        ImageView hot_imageView_7 = (ImageView) view.findViewById(R.id.image_7);
        TextView hot_title_8 = (TextView) view.findViewById(R.id.title_8);
        TextView hot_content_8 = (TextView) view.findViewById(R.id.content_8);
        ImageView hot_imageView_8 = (ImageView) view.findViewById(R.id.image_8);
        AbnormalShapeList hot_abnormalShapeList = null;
        JSONObject hot_jsonObject = null;
        try {
            hot_jsonObject = new JSONObject(json);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        hot_abnormalShapeList = GsonUtils.fromJson(hot_jsonObject.optString("data"), AbnormalShapeList.class);
        if(null!=hot_abnormalShapeList&&null!=hot_abnormalShapeList.info&&hot_abnormalShapeList.info.size()>0) {
            final AbnormalShape info1 = hot_abnormalShapeList.info.get(0);
            if (isshow_sub_module.equals("true")) {
                more.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mContext.startActivity(AgentActivity.intentForFragment(
                                mContext, AgentActivity.FRAGMENT_GOODS_LIST)
                                .putExtra("module_id", info1.module_id
                                ).putExtra("isMore", true));
                    }
                });
            }
                for (int i = 0; i < hot_abnormalShapeList.info.size(); i++) {
                    if (i == 0) {
                        final AbnormalShape info = hot_abnormalShapeList.info.get(i);
                        hot_title_0.setText(hot_abnormalShapeList.info.get(i).item_title);
                        hot_content_0.setText(hot_abnormalShapeList.info.get(i).item_des);
                        MyImageLoader.displayDefaultImage(hot_abnormalShapeList.info.get(i).item_img, hot_imageView_0);
                        module_0.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 1) {
                        final AbnormalShape info = hot_abnormalShapeList.info.get(i);
                        hot_title_1.setText(info.item_title);
                        hot_content_1.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, hot_imageView_1);
                        module_1.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 2) {
                        final AbnormalShape info = hot_abnormalShapeList.info.get(i);
                        hot_title_2.setText(info.item_title);
                        hot_content_2.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, hot_imageView_2);
                        module_2.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 3) {
                        final AbnormalShape info = hot_abnormalShapeList.info.get(i);
                        hot_title_3.setText(info.item_title);
                        hot_content_3.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, hot_imageView_3);
                        module_3.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 4) {
                        final AbnormalShape info = hot_abnormalShapeList.info.get(i);
                        hot_title_4.setText(info.item_title);
                        hot_content_4.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, hot_imageView_4);
                        module_4.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 5) {
                        final AbnormalShape info = hot_abnormalShapeList.info.get(i);
                        hot_title_5.setText(hot_abnormalShapeList.info.get(i).item_title);
                        hot_content_5.setText(hot_abnormalShapeList.info.get(i).item_des);
                        MyImageLoader.displayDefaultImage(hot_abnormalShapeList.info.get(i).item_img, hot_imageView_5);
                        module_5.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 6) {
                        final AbnormalShape info = hot_abnormalShapeList.info.get(i);
                        hot_title_6.setText(info.item_title);
                        hot_content_6.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, hot_imageView_6);
                        module_6.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 7) {
                        final AbnormalShape info = hot_abnormalShapeList.info.get(i);
                        hot_title_7.setText(info.item_title);
                        hot_content_7.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, hot_imageView_7);
                        module_7.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 8) {
                        final AbnormalShape info = hot_abnormalShapeList.info.get(i);
                        hot_title_8.setText(info.item_title);
                        hot_content_8.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, hot_imageView_8);
                        module_8.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
            }
        }
    }

    public static void setDateBrandView(final String module_id, View view, int type, Context context, String json, double weight, String title, String title_icon, String title_color, int column_num, String moudle_icon, String isshow_module_title, String isshow_sub_module) {
        more = (LinearLayout) view.findViewById(R.id.look_more);
        if (isshow_sub_module.equals("true")) {
            more.setVisibility(View.VISIBLE);
        }
        isshow_title = (RelativeLayout) view.findViewById(R.id.isshow_title);
        if (isshow_module_title.equals("false")) {
            isshow_title.setVisibility(View.GONE);
        }
        TextView brand_title_name = (TextView) view.findViewById(R.id.title);
        ImageView brand_icon = (ImageView) view.findViewById(R.id.image_icon);
        ImageView brand_title_image = (ImageView) view.findViewById(R.id.image);
        if (null != title) {
            brand_title_name.setText(title);
        }
        if (null != title_color) {
            brand_title_name.setTextColor(Color.parseColor(title_color));
            brand_icon.setBackgroundColor(Color.parseColor(title_color));
        }
        if (null != title_icon && !TextUtils.isEmpty(title_icon)) {
            MyImageLoader.displayDefaultImage(title_icon, brand_title_image);
        } else {
            brand_title_image.setVisibility(View.GONE);
        }
        LinearLayout module_0= (LinearLayout) view.findViewById(R.id.module_0);
        LinearLayout module_1= (LinearLayout) view.findViewById(R.id.module_1);
        LinearLayout module_2= (LinearLayout) view.findViewById(R.id.module_2);
        LinearLayout module_3= (LinearLayout) view.findViewById(R.id.module_3);
        LinearLayout module_4= (LinearLayout) view.findViewById(R.id.module_4);
        LinearLayout module_5= (LinearLayout) view.findViewById(R.id.module_5);
        LinearLayout module_6= (LinearLayout) view.findViewById(R.id.module_6);
        TextView brand_title_0 = (TextView) view.findViewById(R.id.title_0);
        TextView brand_content_0 = (TextView) view.findViewById(R.id.content_0);
        ImageView brand_imageView_0 = (ImageView) view.findViewById(R.id.image_0);
        TextView brand_title_1 = (TextView) view.findViewById(R.id.title_1);
        TextView brand_content_1 = (TextView) view.findViewById(R.id.content_1);
        ImageView brand_imageView_1 = (ImageView) view.findViewById(R.id.image_1);
        TextView brand_title_2 = (TextView) view.findViewById(R.id.title_2);
        TextView brand_content_2 = (TextView) view.findViewById(R.id.content_2);
        ImageView brand_imageView_2 = (ImageView) view.findViewById(R.id.image_2);
        TextView brand_title_3 = (TextView) view.findViewById(R.id.title_3);
        TextView brand_content_3 = (TextView) view.findViewById(R.id.content_3);
        ImageView brand_imageView_3 = (ImageView) view.findViewById(R.id.image_3);
        TextView brand_title_4 = (TextView) view.findViewById(R.id.title_4);
        TextView brand_content_4 = (TextView) view.findViewById(R.id.content_4);
        ImageView brand_imageView_4 = (ImageView) view.findViewById(R.id.image_4);
        TextView brand_title_5 = (TextView) view.findViewById(R.id.title_5);
        TextView brand_content_5 = (TextView) view.findViewById(R.id.content_5);
        ImageView brand_imageView_5 = (ImageView) view.findViewById(R.id.image_5);
        TextView brand_title_6 = (TextView) view.findViewById(R.id.title_6);
        TextView brand_content_6 = (TextView) view.findViewById(R.id.content_6);
        ImageView brand_imageView_6 = (ImageView) view.findViewById(R.id.image_6);
        AbnormalShapeList brand_abnormalShapeList = null;
        JSONObject brand_jsonObject = null;
        try {
            brand_jsonObject = new JSONObject(json);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        brand_abnormalShapeList = GsonUtils.fromJson(brand_jsonObject.optString("data"), AbnormalShapeList.class);
        if(null!=brand_abnormalShapeList&&null!=brand_abnormalShapeList.info&&brand_abnormalShapeList.info.size()>0) {
            final AbnormalShape info1 = brand_abnormalShapeList.info.get(0);
            if (isshow_sub_module.equals("true")) {
                more.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mContext.startActivity(AgentActivity.intentForFragment(
                                mContext, AgentActivity.FRAGMENT_GOODS_LIST)
                                .putExtra("module_id", info1.module_id
                                ).putExtra("isMore", true));
                    }
                });
            }
                for (int i = 0; i < brand_abnormalShapeList.info.size(); i++) {
                    if (i == 0) {
                        final AbnormalShape info = brand_abnormalShapeList.info.get(i);
                        brand_title_0.setText(info.item_title);
                        brand_content_0.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, brand_imageView_0);
                        module_0.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 1) {
                        final AbnormalShape info = brand_abnormalShapeList.info.get(i);
                        brand_title_1.setText(info.item_title);
                        brand_content_1.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, brand_imageView_1);
                        module_1.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 2) {
                        final AbnormalShape info = brand_abnormalShapeList.info.get(i);
                        brand_title_2.setText(info.item_title);
                        brand_content_2.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, brand_imageView_2);
                        module_2.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 3) {
                        final AbnormalShape info = brand_abnormalShapeList.info.get(i);
                        brand_title_3.setText(info.item_title);
                        brand_content_3.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, brand_imageView_3);
                        module_3.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(),module_id, info.id);
                            }
                        });
                    }
                    if (i == 4) {
                        final AbnormalShape info = brand_abnormalShapeList.info.get(i);
                        brand_title_4.setText(info.item_title);
                        brand_content_4.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, brand_imageView_4);
                        module_4.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 5) {
                        final AbnormalShape info = brand_abnormalShapeList.info.get(i);
                        brand_title_5.setText(info.item_title);
                        brand_content_5.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, brand_imageView_5);
                        module_5.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 6) {
                        final AbnormalShape info = brand_abnormalShapeList.info.get(i);
                        brand_title_6.setText(info.item_title);
                        brand_content_6.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, brand_imageView_6);
                        module_6.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
            }
        }
    }

    public static void setDateFeatureView(final String module_id, View view, int type, Context context, String json, double weight, String title, String title_icon, String title_color, int column_num, String moudle_icon, String isshow_module_title, String isshow_sub_module) {
        more = (LinearLayout) view.findViewById(R.id.look_more);
        if (isshow_sub_module.equals("true")) {
            more.setVisibility(View.VISIBLE);
        }
        isshow_title = (RelativeLayout) view.findViewById(R.id.isshow_title);
        if (isshow_module_title.equals("false")) {
            isshow_title.setVisibility(View.GONE);
        }
        TextView feature_title_name = (TextView) view.findViewById(R.id.title);
        ImageView feature_icon = (ImageView) view.findViewById(R.id.image_icon);
        ImageView featur_title_image = (ImageView) view.findViewById(R.id.image);
        if (null != title) {
            feature_title_name.setText(title);
        }
        if (null != title_color) {
            feature_title_name.setTextColor(Color.parseColor(title_color));
            feature_icon.setBackgroundColor(Color.parseColor(title_color));
        }
        if (null != title_icon && !TextUtils.isEmpty(title_icon)) {
            MyImageLoader.displayDefaultImage(title_icon, featur_title_image);
        } else {
            featur_title_image.setVisibility(View.GONE);
        }
        LinearLayout module_0= (LinearLayout) view.findViewById(R.id.module_0);
        LinearLayout module_1= (LinearLayout) view.findViewById(R.id.module_1);
        LinearLayout module_2= (LinearLayout) view.findViewById(R.id.module_2);
        LinearLayout module_3= (LinearLayout) view.findViewById(R.id.module_3);
        LinearLayout module_4= (LinearLayout) view.findViewById(R.id.module_4);
        LinearLayout module_5= (LinearLayout) view.findViewById(R.id.module_5);
        LinearLayout module_6= (LinearLayout) view.findViewById(R.id.module_6);
        LinearLayout module_7= (LinearLayout) view.findViewById(R.id.module_7);
        TextView feature_title_0 = (TextView) view.findViewById(R.id.title_0);
        TextView feature_content_0 = (TextView) view.findViewById(R.id.content_0);
        ImageView feature_imageView_0 = (ImageView) view.findViewById(R.id.image_0);
        TextView feature_title_1 = (TextView) view.findViewById(R.id.title_1);
        TextView feature_content_1 = (TextView) view.findViewById(R.id.content_1);
        ImageView feature_imageView_1 = (ImageView) view.findViewById(R.id.image_1);
        TextView feature_title_2 = (TextView) view.findViewById(R.id.title_2);
        TextView feature_content_2 = (TextView) view.findViewById(R.id.content_2);
        ImageView feature_imageView_2 = (ImageView) view.findViewById(R.id.image_2);
        TextView feature_title_3 = (TextView) view.findViewById(R.id.title_3);
        TextView feature_content_3 = (TextView) view.findViewById(R.id.content_3);
        ImageView feature_imageView_3 = (ImageView) view.findViewById(R.id.image_3);
        TextView feature_title_4 = (TextView) view.findViewById(R.id.title_4);
        TextView feature_content_4 = (TextView) view.findViewById(R.id.content_4);
        ImageView feature_imageView_4 = (ImageView) view.findViewById(R.id.image_4);
        TextView feature_title_5 = (TextView) view.findViewById(R.id.title_5);
        TextView feature_content_5 = (TextView) view.findViewById(R.id.content_5);
        ImageView feature_imageView_5 = (ImageView) view.findViewById(R.id.image_5);
        TextView feature_title_6 = (TextView) view.findViewById(R.id.title_6);
        TextView feature_content_6 = (TextView) view.findViewById(R.id.content_6);
        ImageView feature_imageView_6 = (ImageView) view.findViewById(R.id.image_6);
        TextView feature_title_7 = (TextView) view.findViewById(R.id.title_7);
        TextView feature_content_7 = (TextView) view.findViewById(R.id.content_7);
        ImageView feature_imageView_7 = (ImageView) view.findViewById(R.id.image_7);
        AbnormalShapeList feature_abnormalShapeList = null;
        JSONObject feature_jsonObject = null;
        try {
            feature_jsonObject = new JSONObject(json);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        feature_abnormalShapeList = GsonUtils.fromJson(feature_jsonObject.optString("data"), AbnormalShapeList.class);
        if (null != feature_abnormalShapeList && null != feature_abnormalShapeList.info && feature_abnormalShapeList.info.size() > 0) {
        final AbnormalShape info1=feature_abnormalShapeList.info.get(0);
        if (isshow_sub_module.equals("true")) {
            more.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mContext.startActivity(AgentActivity.intentForFragment(
                            mContext, AgentActivity.FRAGMENT_GOODS_LIST)
                            .putExtra("module_id",info1.module_id
                            ).putExtra("isMore",true));
                }
            });
        }
            for (int i = 0; i < feature_abnormalShapeList.info.size(); i++) {
                if (i == 0) {
                    final AbnormalShape info=feature_abnormalShapeList.info.get(i);
                    feature_title_0.setText(info.item_title);
                    feature_content_0.setText(info.item_des);
                    MyImageLoader.displayDefaultImage(info.item_img, feature_imageView_0);
                    module_0.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            gotoDetial(info.link_type, info.item_title, info.link_url.toString(),module_id,info.id);
                        }
                    });
                }
                if (i == 1) {
                    final AbnormalShape info=feature_abnormalShapeList.info.get(i);
                    feature_title_1.setText(info.item_title);
                    feature_content_1.setText(info.item_des);
                    MyImageLoader.displayDefaultImage(info.item_img, feature_imageView_1);
                    module_1.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            gotoDetial(info.link_type, info.item_title, info.link_url.toString(),module_id,info.id);
                        }
                    });
                }
                if (i == 2) {
                    final AbnormalShape info=feature_abnormalShapeList.info.get(i);
                    feature_title_2.setText(info.item_title);
                    feature_content_2.setText(info.item_des);
                    MyImageLoader.displayDefaultImage(info.item_img, feature_imageView_2);
                    module_2.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            gotoDetial(info.link_type, info.item_title, info.link_url.toString(),module_id,info.id);
                        }
                    });
                }
                if (i == 3) {
                    final AbnormalShape info=feature_abnormalShapeList.info.get(i);
                    feature_title_3.setText(info.item_title);
                    feature_content_3.setText(info.item_des);
                    MyImageLoader.displayDefaultImage(info.item_img, feature_imageView_3);
                    module_3.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            gotoDetial(info.link_type, info.item_title, info.link_url.toString(),module_id,info.id);
                        }
                    });
                }
                if (i == 4) {
                    final AbnormalShape info=feature_abnormalShapeList.info.get(i);
                    feature_title_4.setText(info.item_title);
                    feature_content_4.setText(info.item_des);
                    MyImageLoader.displayDefaultImage(info.item_img, feature_imageView_4);
                    module_4.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            gotoDetial(info.link_type, info.item_title, info.link_url.toString(),module_id,info.id);
                        }
                    });
                }
                if (i == 5) {
                    final AbnormalShape info=feature_abnormalShapeList.info.get(i);
                    feature_title_5.setText(info.item_title);
                    feature_content_5.setText(info.item_des);
                    MyImageLoader.displayDefaultImage(info.item_img, feature_imageView_5);
                    module_5.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            gotoDetial(info.link_type, info.item_title, info.link_url.toString(),module_id,info.id);
                        }
                    });
                }
                if (i == 6) {
                    final AbnormalShape info=feature_abnormalShapeList.info.get(i);
                    feature_title_6.setText(info.item_title);
                    feature_content_6.setText(info.item_des);
                    MyImageLoader.displayDefaultImage(info.item_img, feature_imageView_6);
                    module_6.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            gotoDetial(info.link_type, info.item_title, info.link_url.toString(),module_id,info.id);
                        }
                    });
                }
                if (i == 7) {
                    final AbnormalShape info=feature_abnormalShapeList.info.get(i);
                    feature_title_7.setText(info.item_title);
                    feature_content_7.setText(info.item_des);
                    MyImageLoader.displayDefaultImage(info.item_img, feature_imageView_7);
                    module_7.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            gotoDetial(info.link_type, info.item_title, info.link_url.toString(),module_id,info.id);
                        }
                    });
                }
            }
        }
    }

    public static void setDateThemeView(final String module_id, View view, int type, Context context, String json, double weight, String title, String title_icon, String title_color, int column_num, String moudle_icon, String isshow_module_title, String isshow_sub_module) {
        more = (LinearLayout) view.findViewById(R.id.look_more);
        if (isshow_sub_module.equals("true")) {
            more.setVisibility(View.VISIBLE);
        }
        isshow_title = (RelativeLayout) view.findViewById(R.id.isshow_title);
        if (isshow_module_title.equals("false")) {
            isshow_title.setVisibility(View.GONE);
        }
        TextView theme_title_name = (TextView) view.findViewById(R.id.title);
        ImageView theme_icon = (ImageView) view.findViewById(R.id.image_icon);
        ImageView theme_title_image = (ImageView) view.findViewById(R.id.image);
        if (null != title) {
            theme_title_name.setText(title);
        }
        if (null != title_color) {
            theme_title_name.setTextColor(Color.parseColor(title_color));
            theme_icon.setBackgroundColor(Color.parseColor(title_color));
        }
        if (null != title_icon && !TextUtils.isEmpty(title_icon)) {
            MyImageLoader.displayDefaultImage(title_icon, theme_title_image);
        } else {
            theme_title_image.setVisibility(View.GONE);
        }
        LinearLayout module_0= (LinearLayout) view.findViewById(R.id.module_0);
        LinearLayout module_1= (LinearLayout) view.findViewById(R.id.module_1);
        LinearLayout module_2= (LinearLayout) view.findViewById(R.id.module_2);
        LinearLayout module_3= (LinearLayout) view.findViewById(R.id.module_3);
        LinearLayout module_4= (LinearLayout) view.findViewById(R.id.module_4);
        LinearLayout module_5= (LinearLayout) view.findViewById(R.id.module_5);
        LinearLayout module_6= (LinearLayout) view.findViewById(R.id.module_6);
        LinearLayout module_7= (LinearLayout) view.findViewById(R.id.module_7);
        TextView theme_title_0 = (TextView) view.findViewById(R.id.title_0);
        TextView theme_content_0 = (TextView) view.findViewById(R.id.content_0);
        ImageView theme_imageView_0 = (ImageView) view.findViewById(R.id.image_0);
        TextView theme_title_1 = (TextView) view.findViewById(R.id.title_1);
        TextView theme_content_1 = (TextView) view.findViewById(R.id.content_1);
        ImageView theme_imageView_1 = (ImageView) view.findViewById(R.id.image_1);
        TextView theme_title_2 = (TextView) view.findViewById(R.id.title_2);
        TextView theme_content_2 = (TextView) view.findViewById(R.id.content_2);
        ImageView theme_imageView_2 = (ImageView) view.findViewById(R.id.image_2);
        TextView theme_title_3 = (TextView) view.findViewById(R.id.title_3);
        TextView theme_content_3 = (TextView) view.findViewById(R.id.content_3);
        ImageView theme_imageView_3 = (ImageView) view.findViewById(R.id.image_3);
        TextView theme_title_4 = (TextView) view.findViewById(R.id.title_4);
        TextView theme_content_4 = (TextView) view.findViewById(R.id.content_4);
        ImageView theme_imageView_4 = (ImageView) view.findViewById(R.id.image_4);
        TextView theme_title_5 = (TextView) view.findViewById(R.id.title_5);
        TextView theme_content_5 = (TextView) view.findViewById(R.id.content_5);
        ImageView theme_imageView_5 = (ImageView) view.findViewById(R.id.image_5);
        TextView theme_title_6 = (TextView) view.findViewById(R.id.title_6);
        TextView theme_content_6 = (TextView) view.findViewById(R.id.content_6);
        ImageView theme_imageView_6 = (ImageView) view.findViewById(R.id.image_6);
        TextView theme_title_7 = (TextView) view.findViewById(R.id.title_7);
        TextView theme_content_7 = (TextView) view.findViewById(R.id.content_7);
        ImageView theme_imageView_7 = (ImageView) view.findViewById(R.id.image_7);
        AbnormalShapeList theme_abnormalShapeList = null;
        JSONObject theme_jsonObject = null;
        try {
            theme_jsonObject = new JSONObject(json);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        theme_abnormalShapeList = GsonUtils.fromJson(theme_jsonObject.optString("data"), AbnormalShapeList.class);
        if(null!=theme_abnormalShapeList&&null!=theme_abnormalShapeList.info&&theme_abnormalShapeList.info.size()>0) {
            final AbnormalShape info1 = theme_abnormalShapeList.info.get(0);
            if (isshow_sub_module.equals("true")) {
                more.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mContext.startActivity(AgentActivity.intentForFragment(
                                mContext, AgentActivity.FRAGMENT_GOODS_LIST)
                                .putExtra("module_id", info1.module_id
                                ).putExtra("isMore", true));
                    }
                });
            }
                for (int i = 0; i < theme_abnormalShapeList.info.size(); i++) {
                    if (i == 0) {
                        final AbnormalShape info = theme_abnormalShapeList.info.get(i);
                        theme_title_0.setText(info.item_title);
                        theme_content_0.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, theme_imageView_0);
                        module_0.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 1) {
                        final AbnormalShape info = theme_abnormalShapeList.info.get(i);
                        theme_title_1.setText(info.item_title);
                        theme_content_1.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, theme_imageView_1);
                        module_1.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 2) {
                        final AbnormalShape info = theme_abnormalShapeList.info.get(i);
                        theme_title_2.setText(info.item_title);
                        theme_content_2.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, theme_imageView_2);
                        module_2.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 3) {
                        final AbnormalShape info = theme_abnormalShapeList.info.get(i);
                        theme_title_3.setText(info.item_title);
                        theme_content_3.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, theme_imageView_3);
                        module_3.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 4) {
                        final AbnormalShape info = theme_abnormalShapeList.info.get(i);
                        theme_title_4.setText(info.item_title);
                        theme_content_4.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, theme_imageView_4);
                        module_4.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 5) {
                        final AbnormalShape info = theme_abnormalShapeList.info.get(i);
                        theme_title_5.setText(info.item_title);
                        theme_content_5.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, theme_imageView_5);
                        module_5.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 6) {
                        final AbnormalShape info = theme_abnormalShapeList.info.get(i);
                        theme_title_6.setText(info.item_title);
                        theme_content_6.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, theme_imageView_6);
                        module_6.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                    if (i == 7) {
                        final AbnormalShape info = theme_abnormalShapeList.info.get(i);
                        theme_title_7.setText(info.item_title);
                        theme_content_7.setText(info.item_des);
                        MyImageLoader.displayDefaultImage(info.item_img, theme_imageView_7);
                        module_7.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                gotoDetial(info.link_type, info.item_title, info.link_url.toString(), module_id, info.id);
                            }
                        });
                    }
                }
        }
    }

    public static void setDateBenrfitView(final String module_id, View view, int type, Context context, String json, double weight, String title, String title_icon, String title_color, int column_num, String moudle_icon, String isshow_module_title, String isshow_sub_module) {
        more = (LinearLayout) view.findViewById(R.id.look_more);
        if (isshow_sub_module.equals("true")) {
            more.setVisibility(View.VISIBLE);
        }
        isshow_title = (RelativeLayout) view.findViewById(R.id.isshow_title);
        if (isshow_module_title.equals("false")) {
            isshow_title.setVisibility(View.GONE);
        }
        TextView title_name = (TextView) view.findViewById(R.id.title);
        ImageView icon = (ImageView) view.findViewById(R.id.image_icon);
        ImageView title_image = (ImageView) view.findViewById(R.id.image);
        if (null != title) {
            title_name.setText(title);
        }
        if (null != title_color) {
            title_name.setTextColor(Color.parseColor(title_color));
            icon.setBackgroundColor(Color.parseColor(title_color));
        }
        if (null != title_icon && !TextUtils.isEmpty(title_icon)) {
            MyImageLoader.displayDefaultImage(title_icon, title_image);
        } else {
            title_image.setVisibility(View.GONE);
        }
        LinearLayout module_0= (LinearLayout) view.findViewById(R.id.module_0);
        LinearLayout module_1= (LinearLayout) view.findViewById(R.id.module_1);
        LinearLayout module_2= (LinearLayout) view.findViewById(R.id.module_2);
        LinearLayout module_3= (LinearLayout) view.findViewById(R.id.module_3);
        LinearLayout module_4= (LinearLayout) view.findViewById(R.id.module_4);
        LinearLayout module_5= (LinearLayout) view.findViewById(R.id.module_5);
        TextView title_0 = (TextView) view.findViewById(R.id.title_0);
        TextView content_0 = (TextView) view.findViewById(R.id.content_0);
        ImageView imageView_0 = (ImageView) view.findViewById(R.id.image_0);
        TextView title_1 = (TextView) view.findViewById(R.id.title_1);
        TextView content_1 = (TextView) view.findViewById(R.id.content_1);
        ImageView imageView_1 = (ImageView) view.findViewById(R.id.image_1);
        TextView title_2 = (TextView) view.findViewById(R.id.title_2);
        TextView content_2 = (TextView) view.findViewById(R.id.content_2);
        ImageView imageView_2 = (ImageView) view.findViewById(R.id.image_2);
        TextView title_3 = (TextView) view.findViewById(R.id.title_3);
        TextView content_3 = (TextView) view.findViewById(R.id.content_3);
        ImageView imageView_3 = (ImageView) view.findViewById(R.id.image_3);
        TextView title_4 = (TextView) view.findViewById(R.id.title_4);
        TextView content_4 = (TextView) view.findViewById(R.id.content_4);
        ImageView imageView_4 = (ImageView) view.findViewById(R.id.image_4);
        TextView title_5 = (TextView) view.findViewById(R.id.title_5);
        TextView content_5 = (TextView) view.findViewById(R.id.content_5);
        ImageView imageView_5 = (ImageView) view.findViewById(R.id.image_5);
        AbnormalShapeList benefit_abnormalShapeList = null;
        JSONObject jsonObject = null;
        try {

            jsonObject = new JSONObject(json);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        benefit_abnormalShapeList = GsonUtils.fromJson(jsonObject.optString("data"), AbnormalShapeList.class);
        if (null != benefit_abnormalShapeList && null != benefit_abnormalShapeList.info && benefit_abnormalShapeList.info.size() > 0) {
        final AbnormalShape info1=benefit_abnormalShapeList.info.get(0);
        if (isshow_sub_module.equals("true")) {
            more.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mContext.startActivity(AgentActivity.intentForFragment(
                            mContext, AgentActivity.FRAGMENT_GOODS_LIST)
                            .putExtra("module_id",info1.module_id
                            ).putExtra("isMore",true));
                }
            });
        }
            for (int i = 0; i < benefit_abnormalShapeList.info.size(); i++) {
                if (i == 0) {
                    final AbnormalShape info=benefit_abnormalShapeList.info.get(i);
                    title_0.setText(info.item_title);
                    content_0.setText(info.item_des);
                    MyImageLoader.displayDefaultImage(info.item_img, imageView_0);
                    module_0.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            gotoDetial(info.link_type, info.item_title, info.link_url.toString(),module_id,info.id);
                        }
                    });
                }
                if (i == 1) {
                    final AbnormalShape info=benefit_abnormalShapeList.info.get(i);
                    title_1.setText(info.item_title);
                    content_1.setText(info.item_des);
                    MyImageLoader.displayDefaultImage(info.item_img, imageView_1);
                    module_1.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            gotoDetial(info.link_type, info.item_title, info.link_url.toString(),module_id,info.id);
                        }
                    });
                }
                if (i == 2) {
                    final AbnormalShape info=benefit_abnormalShapeList.info.get(i);
                    title_2.setText(info.item_title);
                    content_2.setText(info.item_des);
                    MyImageLoader.displayDefaultImage(info.item_img, imageView_2);
                    module_2.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            gotoDetial(info.link_type, info.item_title, info.link_url.toString(),module_id,info.id);
                        }
                    });
                }
                if (i == 3) {
                    final AbnormalShape info=benefit_abnormalShapeList.info.get(i);
                    title_3.setText(info.item_title);
                    content_3.setText(info.item_des);
                    MyImageLoader.displayDefaultImage(info.item_img, imageView_3);
                    module_3.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            gotoDetial(info.link_type, info.item_title, info.link_url.toString(),module_id,info.id);
                        }
                    });
                }
                if (i == 4) {
                    final AbnormalShape info=benefit_abnormalShapeList.info.get(i);
                    title_4.setText(info.item_title);
                    content_4.setText(info.item_des);
                    MyImageLoader.displayDefaultImage(info.item_img, imageView_4);
                    module_4.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            gotoDetial(info.link_type, info.item_title, info.link_url.toString(),module_id,info.id);
                        }
                    });
                }
                if (i == 5) {
                    final AbnormalShape info=benefit_abnormalShapeList.info.get(i);
                    title_5.setText(info.item_title);
                    content_5.setText(info.item_des);
                    MyImageLoader.displayDefaultImage(info.item_img, imageView_5);
                    module_5.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            gotoDetial(info.link_type, info.item_title, info.link_url.toString(),module_id,info.id);
                        }
                    });
                }
            }
        }
    }

    public static void setDateShortcutView(final String module_id, View view, int type, final Context context, String json, double weight, String title, String title_icon, String title_color, int column_num, String moudle_icon, String isshow_module_title, String isshow_sub_module) {
        LinearLayout layout = null;
        layout = (LinearLayout) view.findViewById(R.id.linear);
        if (null != layout) {
            layout.removeAllViews();
        }
        final ShortcutList shortcutList;
        JSONObject object = null;
        try {
            object = new JSONObject(json);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        shortcutList = GsonUtils.fromJson(object.optString("data"), ShortcutList.class);
        //行数
        int lineNumbe = 0;
        //列数
        final int rowNUmber = column_num;
        if(null!=shortcutList&&shortcutList.info.size()>0&&null!=shortcutList.info) {
            lineNumbe = (int) Math.floor(shortcutList.info.size() / rowNUmber);
            layout.addView(LayoutInflater.from(context).inflate(R.layout.item_line, null));
            for (int i = 0; i < lineNumbe; i++) {
                LinearLayout linearLayout = new LinearLayout(context);
                linearLayout.setOrientation(LinearLayout.HORIZONTAL);
                LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
                WindowManager wm = (WindowManager) context
                        .getSystemService(Context.WINDOW_SERVICE);
                int width = wm.getDefaultDisplay().getWidth();
                linearLayout.setLayoutParams(params);
                for (int j = 0; j < rowNUmber; j++) {
                    final Shortcut shortcut = shortcutList.info.get(i * rowNUmber + j);
                    LinearLayout item = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.shortcut_entrance_item, null);
                    LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(width / rowNUmber, LinearLayout.LayoutParams.MATCH_PARENT);
                    item.setLayoutParams(params1);
                    CircleImageView imageView = (CircleImageView) item.findViewById(R.id.image);
                    TextView textView = (TextView) item.findViewById(R.id.title);
                    if (null != shortcutList && null != shortcutList.info && null != shortcut && shortcutList.info.size() > 0) {
                        MyImageLoader.displayDefaultImage(shortcut.shortcut_img, imageView);
                        textView.setText(shortcut.shortcut_title);
                        linearLayout.addView(item);
                    }
                    item.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            if (shortcut.link_type.equals("6")) {
                                callBack.callBack();
//                            context.startActivity(AgentActivity
//                                    .intentForFragment(context,
//                                            AgentActivity.FRAGMENT_CATEGORY_YING).putExtra("title", shortcut.shortcut_title));
                            } else if (shortcut.link_type.equals("7")) {
                                context.startActivity(AgentActivity.intentForFragment(context,
                                        AgentActivity.FRAGMENT_SEASON_SPECIAL).putExtra("title", shortcut.shortcut_title));
                            } else if (shortcut.link_type.equals("8")) {
                                context.startActivity(AgentActivity.intentForFragment(context,
                                        AgentActivity.FRAGMENT_FLASH_SALE).putExtra("title", shortcut.shortcut_title));
                            } else if (shortcut.link_type.equals("9")) {
                                context.startActivity(AgentActivity.intentForFragment(context,
                                        AgentActivity.FRAGMENT_NEW_PRODUCT).putExtra("title", shortcut.shortcut_title));
                            } else if (shortcut.link_type.equals("3")) {
                                if (!TextUtils.isEmpty(shortcut.link_url)) {
                                    context.startActivity(AgentActivity.intentForFragment(
                                            context, AgentActivity.FRAGMENT_GOODS_DETAIL).putExtra("title", shortcut.shortcut_title)
                                            .putExtra(Run.EXTRA_CLASS_ID,
                                                    shortcut.link_url));
                                } else {
                                    context.startActivity(AgentActivity.intentForFragment(
                                            context, AgentActivity.FRAGMENT_GOODS_LIST)
                                            .putExtra("module_id", module_id
                                            ).putExtra("id", shortcut.id).putExtra("isMoreGood", true).putExtra("title", shortcut.shortcut_title));
                                }
                            } else if (shortcut.link_type.equals("4")) {
                                context.startActivity(AgentActivity.intentForFragment(context,
                                        AgentActivity.FRAGMENT_ARTICLE_READER).putExtra("title", shortcut.shortcut_title).putExtra(
                                        "com.shopex.westore.EXTRA_URL", shortcut.link_url));
                            } else if (shortcut.link_type.equals("1")) {
                                context.startActivity(AgentActivity
                                        .intentForFragment(context,
                                                AgentActivity.FRAGMENT_GOODS_LIST).putExtra("title", shortcut.shortcut_title)
                                        .putExtra(Run.EXTRA_CLASS_ID,
                                                shortcut.link_url).putExtra("module_id",module_id).putExtra("id",shortcut.id)
                                );
                            } else if (shortcut.link_type.equals("2")) {
                                context.startActivity(AgentActivity
                                        .intentForFragment(context,
                                                AgentActivity.FRAGMENT_GOODS_LIST).putExtra("title", shortcut.shortcut_title)
                                        .putExtra(Run.EXTRA_VITUAL_CATE,
                                                shortcut.link_url).putExtra("module_id",module_id).putExtra("id",shortcut.id));
                            }

                        }
                    });
                }
                layout.addView(linearLayout);
            }
        }
    }
    //点击异形模块,跳转到不同的界面
    public static void gotoDetial(String urlType, String title, String link_url,String module_id,String id){
            if ("3".equals(urlType)) {
                if(!TextUtils.isEmpty(link_url)) {
                    mContext.startActivity(AgentActivity.intentForFragment(
                            mContext, AgentActivity.FRAGMENT_GOODS_DETAIL)
                            .putExtra(Run.EXTRA_CLASS_ID,
                                    link_url).putExtra("title", title));
                }
                else {
                    mContext.startActivity(AgentActivity.intentForFragment(
                            mContext, AgentActivity.FRAGMENT_GOODS_LIST)
                            .putExtra("module_id", module_id
                            ).putExtra("id", id).putExtra("isMoreGood", true).putExtra("title", title));
                }
            } else if ("4".equals(urlType)) {
                mContext.startActivity(AgentActivity.intentForFragment(mContext,
                        AgentActivity.FRAGMENT_ARTICLE_READER).putExtra(
                        "com.shopex.westore.EXTRA_URL",link_url).putExtra("title",title));
            } else if ("1".equals(urlType)) {
                mContext.startActivity(AgentActivity
                        .intentForFragment(mContext,
                                AgentActivity.FRAGMENT_GOODS_LIST)
                        .putExtra(Run.EXTRA_CLASS_ID,
                               link_url).putExtra("title",title).putExtra("type",urlType).putExtra("module_id",module_id).putExtra("id",id)
                );
            } else if ("2".equals(urlType)) {
                mContext.startActivity(AgentActivity
                        .intentForFragment(mContext,
                                AgentActivity.FRAGMENT_GOODS_LIST)
                        .putExtra(Run.EXTRA_VITUAL_CATE,
                                link_url).putExtra("title",title).putExtra("type",urlType).putExtra("module_id",module_id).putExtra("id",id));
            }
    }

    //调到分类
    public interface  CallBack{
        void  callBack();
    }

}
